/*  
 *  King.cs 
 *  Copyright(c) 2007 Adam W Adair
 *
 *  This file is part of Adam's Chess Engine (ACE).
 *
 *  ACE is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *   
 *  ACE is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with ACE; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
using System;
using System.Collections.Generic;
using System.Text;

namespace ACE.Board
{
    class King : Piece
    {
        public static readonly int[] MOVEOFFSETS = { -11, -10, -9, -1, 1, 9, 10, 11 };
        private static King m_black;
        private static King m_white;

        private const int KING_VALUE = 0; //King doesn't really have value.  He is a special case.

        private King(PlayerColor c)
            : base(c)
        {
            /// Having a value for the king is kind of silly, but 
            /// this is the way the object model was built.  I set it
            /// high.  It really doesn't matter.
            /// 
            PieceValue = KING_VALUE;
        }


        public static King BlackKing
        {
            get
            {
                if (m_black != null) return m_black;
                else
                {
                    m_black = new King(PlayerColor.Black);
                }
                return m_black;
            }
        }

        public static King WhiteKing
        {
            get
            {
                if (m_white != null) return m_white;
                else
                {
                    m_white = new King(PlayerColor.White);
                }
                return m_white;
            }
        }

        public override string PieceChar
        {
            get { return "k"; }
        }

        /// <summary>
        /// false.  king does not slide.
        /// </summary>
        public override bool CanSlide
        {
            get { return false; }
        }

        public override int[] MoveOffsets
        {
            get { return MOVEOFFSETS; }
        }

    }
}
